package 守护线程.Test01;

public class Test01 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new BakDataRunnable());
        t1.setName("备份数据的线程");
        //启动线程之前，将线程设置为启动线程
        t1.setDaemon(true);
        t1.start();
        for (int i = 0; i < 10; i++){
            System.out.println(Thread.currentThread().getName() + "---->" + i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
